Closed EricZeiberg closed 10 years ago
You need to close the microphone before you reopen it. The issue comes from the fact that you keep trying to run the code over and over again with only one if statement terminating in the mic.close() being called. I've forked the gist, but I do not know how to submit a pull request so just check out my fork to solve the issue.
Its still throwing the line with format PCM_SIGNED 8000.0 Hz, 16 bit, mono, 2 bytes/frame, little-endian not supported error.
Yes, my computer does have a microphone. I was trying the api out before, and it did correctly get what I said. So, its definitely getting my mic. The error only happens when I speak above the threshold.
On Sun, Apr 20, 2014 at 9:34 PM, Aaron Gokaslan notifications@github.comwrote:
Does your computer even have a microphone? If it does, look up what audio formats it supports and override the getAudioFormat() method in microphone.
— Reply to this email directly or view it on GitHubhttps://github.com/The-Shadow/java-speech-api/issues/39#issuecomment-40910535 .
Hellooo?
Where has Aaron vanished?
I need help too. Eric, if you can help me, please have a look at my issue.
https://github.com/The-Shadow/java-speech-api/issues/40
On Thu, Apr 24, 2014 at 2:54 AM, Eric Zeiberg notifications@github.comwrote:
Hellooo?
— Reply to this email directly or view it on GitHubhttps://github.com/The-Shadow/java-speech-api/issues/39#issuecomment-41216724 .
With my sincere greetings, Mayukh Nair
Sigh, can't a guy go on vacation. Anyway to the point, you need to close the microphone before writing to a second audio file as is the case with filename1. Microphone can only write to one file at a time. If you are just using the microphone to detect volume, use mic.open() instead of mic.captureAudioToFile(String). Mic.open() allows you to get metrics such as volume while allowing the targetdataline to be available.
Ok, I'll try that when I get home. Thanks :)
On Thu, Apr 24, 2014 at 8:10 AM, Aaron Gokaslan notifications@github.comwrote:
Sigh, can't a guy go on vacation. Anyway to the point, you need to close the microphone before writing to a second audio file as is the case with filename1. Microphone can only write to one file at a time. If you are just using the microphone to detect volume, use mic.open() instead of mic.captureAudioToFile(String). Mic.open() allows you to get metrics such as volume while allowing the targetdataline to be available.
— Reply to this email directly or view it on GitHubhttps://github.com/The-Shadow/java-speech-api/issues/39#issuecomment-41272400 .
Sigh, the price of maintaining an on-fire GitHub repo.
On Thursday, April 24, 2014, Eric Zeiberg notifications@github.com wrote:
Ok, I'll try that when I get home. Thanks :)
On Thu, Apr 24, 2014 at 8:10 AM, Aaron Gokaslan notifications@github.com<javascript:_e(%7B%7D,'cvml','notifications@github.com');>wrote:
Sigh, can't a guy go on vacation. Anyway to the point, you need to close the microphone before writing to a second audio file as is the case with filename1. Microphone can only write to one file at a time. If you are just using the microphone to detect volume, use mic.open() instead of mic.captureAudioToFile(String). Mic.open() allows you to get metrics such as volume while allowing the targetdataline to be available.
— Reply to this email directly or view it on GitHub< https://github.com/The-Shadow/java-speech-api/issues/39#issuecomment-41272400>
.
— Reply to this email directly or view it on GitHubhttps://github.com/The-Shadow/java-speech-api/issues/39#issuecomment-41283198 .
With my sincere greetings, Mayukh Nair
Still throwing the same error, heres my class - https://gist.github.com/MasterEjay/11267714
Now you are using two microphone objects? That will cause an error as well. Just reuse the MicrophoneAnalyzer class, it extends the Microphone class. Your setup is unnecessarily complicated. The microphone class assumes control of the TargetDataLine which directly controls the entire microphone. Try reducing it to one Microphone class. Unfortunately, TargetDataLine requires that it has full control over the hardware in question. For this reason, you cannot call two TargetDataLines at the same time.
On Thu, Apr 24, 2014 at 4:08 PM, Eric Zeiberg notifications@github.comwrote:
Still throwing the same error, heres my class - https://gist.github.com/MasterEjay/11267714
— Reply to this email directly or view it on GitHubhttps://github.com/The-Shadow/java-speech-api/issues/39#issuecomment-41325846 .
Really sorry to keep pestering you about this, but its still giving me the error. https://gist.github.com/MasterEjay/11274633
Sorry about that, I just was able to reproduce the bug and just committed a patch. Sorry, it was a regression in one of the newer versions of the API. Thank you so much for the information.
Arrg, still not working for me. I grabbed your code changes to Microphone class and built my own version.
Is it still throwing the same error?
Yes
On Sat, Apr 26, 2014 at 12:31 PM, Aaron Gokaslan notifications@github.comwrote:
Is it still throwing the same error?
— Reply to this email directly or view it on GitHubhttps://github.com/The-Shadow/java-speech-api/issues/39#issuecomment-41473279 .
First of all, the code you posted is a mess. You don't want to call dozens of mic.captureAudioFile in a loop, it's not a good idea. Try using these two methods I wrote: https://gist.github.com/Skylion007/11325165
Thanks, but that doesn't seem to be working either. (omg) Its creating a weird file called AudioTestNow.wav.flac instead of just AudioTestNow.wav.
Because you are converting the file to FLAC. -_- Is there anyway I can contact you? This might be easier over chat.
Yeah, sure, what's your skype?
On Sat, Apr 26, 2014 at 1:26 PM, Aaron Gokaslan notifications@github.comwrote:
Because you are converting the file to FLAC. -_- Is there anyway I can contact you? This might be easier over chat.
— Reply to this email directly or view it on GitHubhttps://github.com/The-Shadow/java-speech-api/issues/39#issuecomment-41474828 .
Glad to see upgrading the latest release solved the issue.
Me too! Thanks for all your help Aaron. If I'd been in your position, I would have said "Get lost" to me a while back :)
On Sat, Apr 26, 2014 at 1:56 PM, Aaron Gokaslan notifications@github.comwrote:
Glad to see upgrading the latest release solved the issue.
— Reply to this email directly or view it on GitHubhttps://github.com/The-Shadow/java-speech-api/issues/39#issuecomment-41475737 .
Whenever I try to run mic.captureAudioToFile, it gives me a javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED 8000.0 Hz, 16 bit, mono, 2 bytes/frame, little-endian not supported error
Here's my code - https://gist.github.com/MasterEjay/11126602