Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.sound.sampled.*;
- public class AudioPump {
- public static void main(String[] args) throws Exception {
- AudioFormat format = new AudioFormat(8000f, 8, 1, false, false);
- DataLine.Info info = new DataLine.Info(SourceDataLine.class, format);
- SourceDataLine soundLine = (SourceDataLine)AudioSystem.getLine(info);
- soundLine.open(format, 32000);
- soundLine.start();
- byte[] buffer = new byte[8];
- int t = 0;
- while(true) {
- for(int n = 0; n < buffer.length; n++) {
- buffer[n] = (byte)f(t++);
- }
- soundLine.write(buffer, 0, buffer.length);
- }
- }
- private static int f(int t) {
- return (t>>7|t|t>>6)*10+4*(t&t>>13|t>>6);
- //return (t*(t>>5|t>>8))>>(t>>16);
- //return t*(((t>>12)|(t>>8))&(63&(t>>4)));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement