LoginLogin

Importing waveforms from a PC to SB

Root / Submissions / [.]

PerskaCreated:
List of sections

Before Starting

Before staring, make sure you have the following: SmileBASIC File Manager Wav Recorder A audio managing tool. (I used Audacity for this tutorial) A PC with Windows installed on it. (you may be able to use Mono on Linux to run this but IDK) Download the WAV2SBWAV tool from here.

Preparing your audio file

Open your audio file in Audacity, and first, set the sample rate to 8180. (there is no option for 8180 but you can write it there manually) Next, make the audio track mono via Tracks->Stereo Track to Mono. Finally, select File->Export Audio. On the save dialog, set the save format to be Other uncompressed formats and then select Options. Set the settings to be WAV (Microsoft) and Unsigned 8-Bit PCM. Now save the new file as anything.

Exporting audio to SmileBASIC format

Open the WAV2SBWAV tool. Select Load WAV and then select the file made earlier. (if the WAV file's length is over 30s, tick Ignore sample count) After it's done writing the data, select Save SBWAV and save it anywhere you want to. To see how to import the file to SB, see this. Make sure the filename starts with B and is UPPERCASE

Known bugs(?) of the tool:

  • The tool apparently overwrites the footer a bit, but that really shouldn't be a problem.
  • The date is totally wrong. I might change it to use the current time & date.
  • Ticking "Ignore sample count" makes it also ignore the sample rate. I haven't tested yet what happens when you play a file like that, but I don't think it'll make the wavplayer library explode/freak out/fly to space.

Replying to:Midnoclose
It won't let me change the rate to 8180
Sucs I don't have a number pad on my keyboard

Replying to:Midnoclose
It won't let me change the rate to 8180
I think you can copy/paste "8180" into the input box

Replying to:Midnoclose
It won't let me change the rate to 8180
Tried that too. :C

Replying to:Midnoclose
It won't let me change the rate to 8180
In the preferences make 8180 the default

Can you make a 32 bit version of wav2sbwav?

Replying to:h267
Can you make a 32 bit version of wav2sbwav?
it is

Replying to:h267
Can you make a 32 bit version of wav2sbwav?
Well I'm having trouble running it then :/

Replying to:h267
Can you make a 32 bit version of wav2sbwav?
What does the program throw at you when you run the executable?

Replying to:h267
Can you make a 32 bit version of wav2sbwav?
*path* is not a valid Win32 application.

Wouldn't it also be better to not pack a single byte into a 4-byte integer? Instead, you could make it store 4 different bytes in one integer, cutting the size four fold. Reading 4 bytes from a 32 bit integer shouldn't be difficult if you write a small code snippet to put on the page. I should be able to pack in 8 minutes of audio instead of 2.

Replying to:h267
Wouldn't it also be better to not pack a single byte into a 4-byte integer? Instead, you could make it store 4 different bytes in one integer, cutting the size four fold. Reading 4 bytes from a 32 bit integer shouldn't be difficult if you write a small code snippet to put on the page. I should be able to pack in 8 minutes of audio instead of 2.
because then you need to decompress it which is annoying

Replying to:h267
Wouldn't it also be better to not pack a single byte into a 4-byte integer? Instead, you could make it store 4 different bytes in one integer, cutting the size four fold. Reading 4 bytes from a 32 bit integer shouldn't be difficult if you write a small code snippet to put on the page. I should be able to pack in 8 minutes of audio instead of 2.
But is that really worth a 4x file size inflation? Maybe there could at least be a toggle for compression.

Replying to:h267
Wouldn't it also be better to not pack a single byte into a 4-byte integer? Instead, you could make it store 4 different bytes in one integer, cutting the size four fold. Reading 4 bytes from a 32 bit integer shouldn't be difficult if you write a small code snippet to put on the page. I should be able to pack in 8 minutes of audio instead of 2.
Though I guess I forgot about compressing it through SB itself. Still, the option would be helpful.

Is there one there I don't need a PC?

Replying to:the_squat1115
Is there one there I don't need a PC?
how would you even transfer the files at that point?