|
Post by andy55 on Sept 2, 2021 7:11:21 GMT -8
Hi all
Every time I try to create a . Ima file to play back audio the results are very poor The sample file , mezermirize .ima file plays fine
Is there a method that someone can share to properly prepare the audio files for playback I have tried multiple tools with no success Maybe removing the header file and metadata ? I tried the bridge works tools, with no success as well
Any help would be greatly appreciated
|
|
|
Post by tftlcdcyg on Sept 2, 2021 13:50:19 GMT -8
Personally I use the sox tool (http://sox.sourceforge.net/). I follow these steps and I think that you can get an acceptable quality of ima files 1 Download the conversion tool sox.sourceforge.net/The latest version is 14.4.2, it works 100% in Windows 10 Pro 64-bit sourceforge.net/projects/sox/files/sox/2 Install sox in the folder c: \ sox 3 Add the folder c: \ sox to the environment variables so that it is recognized as a command by the windows powershell 4 Using an audio extractor from videos or some audio file conversion tool, get the audio-source track in wav format of a channel, name it with the format ********. wav pistaX.wav, for example 5 In the windows command window enter the folder c: \ sox 6 Copy the audio track obtained in step 4, in the folder c: \ sox 7 In the command window enter the processing line of the sox command as: sox pistaX.wav pista.ima channels 1 gain -3 norm -3 speed 1.1 We give enter. In the folder c: \ sox, the file pistaX.ima will appear Remember that ima ADPCM files are audio files with a high degree of compression, so that some audio processing error can be added, which results in distortions or speed reductions when playing them. The line I suggest: channels 1 gain -3 norm -3 speed 1.1 allows you to send the audio signal through a single channel, compensating the possible noise with gain and norm; adding a bit of speed to get the best possible quality. There are many other commands that could improve the final file, but this is a trial and error process. I think with those elements, you can get a good file in ima format without so many weird distortions.  My personal IMA player (for the Teensy 4.x and SdFat party) #include <GDT4Xv134.h>
const char song[7][15] = {"This.ima","This2.ima","This3.ima","This4.ima"}; int IDAudio=0;
static void Player() { Streamer stream; stream.begin(song[IDAudio]); byte playing = 1;
while(1) { GD.ClearColorRGB(0x100000); GD.Clear(); GD.get_inputs();
GD.SaveContext(); GD.cmd_text(GD.w/2, 20, 29, OPT_CENTER, song[IDAudio]); GD.Tag(100); GD.cmd_fgcolor(0x005000); GD.cmd_button((GD.w/2)-(100/2), (GD.h/2)+(60/2), 100, 60, 28, 0,"Next"); GD.Tag(255); GD.Tag(101); GD.cmd_fgcolor(0x000050); GD.cmd_button(5, (GD.h/2)+(60/2), 100, 60, 28, 0,"MP"); GD.Tag(255); GD.RestoreContext();
uint16_t val, range; stream.progress(val, range);
GD.SaveContext(); GD.ColorRGB(0x00ff00); GD.cmd_fgcolor(0x000000); GD.cmd_bgcolor(0xff0000); GD.cmd_slider(GD.w/4, 60, GD.w/2, 8, 0, val, range); GD.RestoreContext();
GD.cmd_number(GD.w/2, GD.h/3, 27, OPT_CENTERX|OPT_RIGHTX|OPT_SIGNED, val); GD.cmd_number(GD.w/2, GD.h/2, 27, OPT_CENTERX|OPT_RIGHTX|OPT_SIGNED, range);
if(val>=range) { IDAudio =IDAudio +1; if(IDAudio>=4){IDAudio=0;} Player(); }
if (GD.inputs.tag == 100) { delay(170); IDAudio =IDAudio +1; if(IDAudio>=4){IDAudio=0;} Player(); }
if (GD.inputs.tag == 101) { MP(); } GD.swap(); if (!stream.feed()) { playing = 0; GD.sample(0, 0, 0, 0); } } }
void setup() { GD.begin(); MP(); }
void loop(){}
void MP() { GD.sample(0, 0, 0, 0); while(1)
{ GD.ClearColorRGB(0x001050); GD.Clear(); GD.get_inputs();
GD.SaveContext(); GD.Tag(102); GD.cmd_fgcolor(0x500000); GD.cmd_button((GD.w/2), (GD.h/2)-(60/2), 140, 60, 28, 0,"IMA Player"); GD.Tag(255); GD.RestoreContext();
if (GD.inputs.tag == 102) { Player(); } GD.swap(); } }   TFT: BT817, 5" MCU: Teensy 4.1  Ima files: www.mediafire.com/file/pfhft3j2oymwqgt/IMA_audio.zip/file
|
|