Obtain the most tiny audio file with a MP3 [Resolved]

Just starting out? Need help? Post your questions and find answers here.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Obtain the most tiny audio file with a MP3

Post by Kwai chang caine »

Yes i have understand now...
But i want use directly the encoder with PB.
So i can make a runprogram of OGGENC like the FFMPEG 8)

I have see, on your great link also the MPC enc..perhaps it's the same things :D

Thanks, i try all that
I wish you a good day 8)
Last edited by Kwai chang caine on Wed Jan 13, 2010 2:28 pm, edited 2 times in total.
ImageThe happiness is a road...
Not a destination
jamirokwai
Enthusiast
Enthusiast
Posts: 798
Joined: Tue May 20, 2008 2:12 am
Location: Cologne, Germany
Contact:

Re: Obtain the most tiny audio file with a MP3

Post by jamirokwai »

Kwaï chang caïne wrote:Yes i have understand now...
But i want use directly the encoder with PB.
So i can make a runprogram of OGGENC like the FFMPEG 8)

I have see, on your great link also the MPC enc..perhaps it's the same things :D

Thanks, i try all that
I wish you a good day 8)
Hi KCC,

I use this encoder in one of my tools via the commandline. However the tool is for Mac OS X, but the command-line itself should be the same...
If you like, I will have a look this evening, how I did this. Means, when I get home, and provide an example.
Regards,
JamiroKwai
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Obtain the most tiny audio file with a MP3

Post by Kwai chang caine »

Thanks a lot JAMIROKWAI 8)

Because with all this parameters, i don't know exactely what parameters, i must use, for create mono and better tiny sampling for obtain the more little file :oops:
ImageThe happiness is a road...
Not a destination
jamirokwai
Enthusiast
Enthusiast
Posts: 798
Joined: Tue May 20, 2008 2:12 am
Location: Cologne, Germany
Contact:

Re: Obtain the most tiny audio file with a MP3

Post by jamirokwai »

Kwaï chang caïne wrote:Thanks a lot JAMIROKWAI 8)

Because with all this parameters, i don't know exactely what parameters, i must use, for create mono and better tiny sampling for obtain the more little file :oops:
Hiya,

I made my code into something more general... Here you are.
With the options used for ConvertToOgg, this shrinked a 130k file to 6k... Your results may vary.
The Input has to be .wav, I think... My OGGEnc-File (for Mac OS X) was made by Michael Smith of XIPH.

Code: Select all

; Code to convert a test.wav to test.ogg using oggenc
; you may us this snippet however you like, but please give credit :)
; (p) 2009-2010 quadWorks.de

#Quality  = 3   ;   3 is Standard, 0 worst, 10 best quality
#minBits  = 80  ;  80 is Standard, 16 is worst, 384 is best
#maxBits  = 128 ; 128 is Standard, like above
#varBits  = 128 ; 128 is Standard, like above, if set to 0, then use from #minBits to #maxBits
#toMono   = 0   ; 0 = Stereo, 1 = convert to Mono
#toSample = 0   ; 0 = don't downsample, everything else (11025, 22050, 32000, 44100, 48000) downsample
#inName   = "test.wav"
#toName   = "test.ogg"
#Path     = "c:/your/path/"

; this one produces the command line options for oggenc...
Procedure.s ConvertToOgg(inName$, toName$, Quality, minBits, maxBits, varBits, toMono, toSample)
 encode$ = " -q" + Str(Quality)
 If varbits = 0
  encode$ + " -m" + Str(minBits)
  encode$ + " -M" + Str(maxBits)
 Else
  encode$ + " -b" + Str(varBits)
 EndIf
 If toMono = 1
  encode$ + " --downmix"
 EndIf
 If toSample <> 0
  encode$ + " --resample " + Str(toSample)
 EndIf
 encode$ + " " + Chr(34) + inName$ + Chr(34)
 encode$ + " -o" + toName$ 
 ProcedureReturn encode$
EndProcedure

; really good quality
;encode$ = ConvertToOgg(#InName, #toName, #Quality, #minBits, #maxBits, #varBits, #toMono, #toSample)
;really bad, but small... : 
encode$ = ConvertToOgg(#InName, #toName, 0, 16, 32, 0, 1, 11025)

; here you have to set the full path to oggenc, and the full path to the working directory of your test.wav and test.ogg
x  = RunProgram(#Path + "oggenc.exe", encode$, #Path, #PB_Program_Open|#PB_Program_Read)
If x <> 0
 While ProgramRunning(x)
  Debug ReadProgramString(x)
 Wend
 If ProgramExitCode(x) <> 0
  Debug "error"
 Else
  Debug "success"
 EndIf
 CloseProgram(x)
EndIf
Regards,
JamiroKwai
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Obtain the most tiny audio file with a MP3

Post by Kwai chang caine »

Thanks a lot JAMIROKWAI 8)

I have try your code

1/ I have put a wave in c:\
2/ I have put OGGENC.exe and the three other file in c:\
3/ I have change the #Path to c:\

And your code return an error :(

I have see the value of "encode$" and this is the result

Code: Select all

 -q0 -m16 -M32 --downmix --resample 11025 "test.wav" -otest.ogg
Perhaps an error of space with "-otest.ogg" :roll:
I have try this, and nothing better
I have add some chr(34) also...and not better... :(
ImageThe happiness is a road...
Not a destination
jamirokwai
Enthusiast
Enthusiast
Posts: 798
Joined: Tue May 20, 2008 2:12 am
Location: Cologne, Germany
Contact:

Re: Obtain the most tiny audio file with a MP3

Post by jamirokwai »

Kwaï chang caïne wrote:Thanks a lot JAMIROKWAI 8)

I have try your code

1/ I have put a wave in c:\
2/ I have put OGGENC.exe and the three other file in c:\
3/ I have change the #Path to c:\

And your code return an error :(

I have see the value of "encode$" and this is the result

Code: Select all

 -q0 -m16 -M32 --downmix --resample 11025 "test.wav" -otest.ogg
Perhaps an error of space with "-otest.ogg" :roll:
I have try this, and nothing better
I have add some chr(34) also...and not better... :(
Hi KCC,

I tried the above commandline with a Mono-Wave. OGGEnc.exe does not like to --downmix to Mono, when the file already is in mono... (odd, on Mac OS, this worked with the same wave...)

Download the OGGEnc from http://www.rarewares.org/ogg-oggenc.php and rename the oggenc2.exe to oggenc.exe. This worked for me when putting oggenc.exe and test.wav to c:\ with the Original code, BUT using this command:

Code: Select all

encode$ = ConvertToOgg(#InName, #toName, 0, 16, 32, 0, 0, 11025)
.

You see the toMono-Part is 0. The result was the very same file test.ogg.
For #Path, you should use "C:\" then. Probably #toName has to give the full path of the output, e.g. c:\myoggs\output.ogg. I didn't test that.

Last idea: try to use oggenc.exe at the command-line with oggenc.exe -q0 -m16 -M32 --downmix --resample 11025 "test.wav" -otest.ogg

Bonne nuit :)
Regards,
JamiroKwai
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Obtain the most tiny audio file with a MP3

Post by Kwai chang caine »

Thanks thanks JAMIROKWAI 8)
I moove i moove thanks to you and a friend in french forum also interesting by this subject :D
I have try directly in command line, and that already don't works

But effectively your code works now, i obtain a file of :

Code: Select all

;encode$ = ConvertToOgg(#InName, #toName, 0, 16, 32, 0, 0, 11025) ; Pour 6 Secondes ==> 65 = 16 K
encode$ = ConvertToOgg(#InName, #toName, 0, 8, 16, 0, 0, 8000) ; Pour 6 Secondes ==> 65 = 11 K
encode$ = ConvertToOgg(#InName, #toName, -1, 8, 16, 0, 0, 8000) ; Pour 6 Secondes ==> 65 = 9 K
1/ 16k to an original file of 64 K in 11025 with q=0
2/ 11K to an original file of 64 K in 8000 with q=0
3/ 9K to an original file of 64 K in 8000 with q=-1

I have two questions again ?? :oops:
1/ Now, believe you that it's possible to go down more ???
I have try 4000 but that don't works :(
2/ Believe you it's possible to start with a MP3 ????

Thanks to your help 8)
Bonne nuit
Danke .. gute Nacht zu :wink:
ImageThe happiness is a road...
Not a destination
jamirokwai
Enthusiast
Enthusiast
Posts: 798
Joined: Tue May 20, 2008 2:12 am
Location: Cologne, Germany
Contact:

Re: Obtain the most tiny audio file with a MP3

Post by jamirokwai »

Kwaï chang caïne wrote:Thanks thanks JAMIROKWAI 8)
I moove i moove thanks to you and a friend in french forum also interesting by this subject :D
Fine :)
Kwaï chang caïne wrote:I have two questions again ?? :oops:
1/ Now, believe you that it's possible to go down more ???
I have try 4000 but that don't works :(
2/ Believe you it's possible to start with a MP3 ????
1. I think, 8000 is the lowest Hz, OGGenc will be able to use.
Smaller is, for that reason, not possible. The smallest is 8000, Mono, 16kbs minRate, and 16kbs maxRate, I think.
2. OGGEnc will only read Raw or Wave, so you have to decode the MP3 first to Wave, and throw the resulting Wave towards OGGEnc :D
Kwaï chang caïne wrote:Thanks to your help 8)
You're welcome.
Bonne nuit
Danke .. gute Nacht zu :wink:[/quote]

8)
Regards,
JamiroKwai
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Obtain the most tiny audio file with a MP3

Post by Kwai chang caine »

Thanks for all this explanation...
Now that's clear in my mind 8)
I have reach the limit of compression with OGG :D

I wish you a very good day 8)
ImageThe happiness is a road...
Not a destination
Post Reply