Howdy Folks!
Do you guys know how I can convert a binary code to sound?
Howdy Folks!
Do you guys know how I can convert a binary code to sound?
Is it supposed to be a sound? If so you can use File → Import → Raw Data but you have to know (or guess) the bit depth, sample rate, and a few more parameters.
If it’s not audio it’s usually going to sound like random noise.
…You can open a WAV file as raw data and everything will be OK if know the format/parameters, except you’ll get a little “glitch” in the beginning that sounds like a “tick” where the file header is converted to audio.
Of course ALL computer files are “binary” so the application has to “know” what the bits & bytes represent.
convert a binary code to sound?
It would be good to flesh that out a bit. What’s the show or presentation? Where did the code come from? Was it sound originally?
This is what it sounds like when a USB microphone binary data gets into the sound channel by accident. Is that what you want?
Koz
I got the idea form a interview, I have uploaded a small portion of the interview. it’s 0:41 secs long
https://youtu.be/rVGAR00khHI
Convert the binary representation of alphanumeric-characters into sound-pulses/drumbeats ? ,
(a hybrid of RTTY & Morse-code ?).
MIDI instruments convert binary code into sound.
MIDI is a binary code that can send instructions to an instrument (such as a synthesizer) to tell it what to play. See: MIDI - Wikipedia
One can also create speech, music, or other “sounds” by feeding a PWM (Pulse Width Modulated)
bit stream through a low pass filter, essentially converting it into an analogue representation and feeding
that into a suitable amplifier to drive low impedance speakers or headphones.
The diagram below, shows how to convert PCM audio data to PWM.
Note that it’s for 16 bit audio, for 8 bit, it’s different as the audio is normally represented as signed data
with a value of zero being at 127 (or 7F hex).
Of course you will also get worse quality audio as a result due to the limit of the sample values.
If the resulting audio does not have to be studio quality (but still more than adequate), you could use
a low spec standalone micro-controller like a 8051 or even an Arduino.
This then allows for “crude” tones, sounds and even speech synthesis on low spec devices.
“Danger, Will Robinson”.
With some “bit-banging”, you could experiment using a good old fashioned serial port (RS-232)
to create the PWM bit-stream and send that on to a LPF and amplifier.
This also has the added advantage of a higher voltage swing (versus TTL or CMOS) and will give you
true positive and negative levels to re-create your audio, instead of having to create a “floating earth”
of VCC/2, or roughly 2.5V max.
Of course you would have to use quite a high baud-rate.
Even serial ports from the last decade can easily reach 115Kbaud and maybe you could even put the
start and stop bits to good use and thereby giving you another 2 bits of audio “data”.
Alternatively, you can use those extra bits to mute the amplifier (between samples) to avoid clicks and thuds.
The quality of the resulting audio can also be improved by using a multi-order LC rather than RC low pass filter, but
just watch out for “ringing” if the filter is too steep or becomes resonant at some frequency in the audible range.