Sound Analysis

RSS for tag

Analyze streamed and file-based audio to classify it as a particular type using Sound Analysis.

Posts under Sound Analysis tag

35 Posts

Post

Replies

Boosts

Views

Activity

Unexpected results from SNClassifySoundRequest
I'm seeing unexpected results when examining the results from a sound classification test. Whilst I appear to get accurate startTime for observations, the duration is always the same as the value put into the windowDuration. I'm guessing I'm misunderstanding the purpose of duration in the classification results. The link here says: The time range’s CMTime values are the number of audio frames at the analyzer’s sample rate. Use these time indices to determine where, in time, the result corresponds to the original audio. My understanding of this statement is it should give me the startTime AND the duration of that detection event. For example, if I attempt to detect a crowd sound and that sound lasts for 1.8 seconds, then I should see 1.8 seconds in the duration. Below is some code showing what I'm seeing. Initialisation of request.windDuration of 1 second. If I change this to any other value, that value is reported back as the duration of the event. Even if the event is half a second in duration. Any help in either a code issue or understanding the results better would be appreciated. Thanks let request = try SNClassifySoundRequest(classifierIdentifier: .version1) request.overlapFactor = 0.8 request.windowDuration = CMTimeMakeWithSeconds(600, preferredTimescale: 600) My code to get the values out of the SNResult func request(_ request: SNRequest, didProduce result: SNResult) { guard let analysisResult = result as? SNClassificationResult, let predominantSound = analysisResult.classifications.first?.identifier, soundsToDetect.contains(predominantSound) else { return } let startTime = analysisResult.timeRange.start.seconds let duration = analysisResult.timeRange.duration.seconds let confidence = analysisResult.classifications.first?.confidence ?? 0.0 let detectedSound = ClassificationObject(id: UUID(), name: predominantSound, startTime: startTime, duration: duration, confidence: confidence) self.detectedSounds.append(detectedSound) }
0
0
1.2k
Apr ’23
Analysis of podcast audio features
Hello! I am working on the final thesis of my Bachelor Degree, and I would like to focus on podcasts. I found an interesting dataset on Kaggle which includes reviews of iTunes podcasts and the link to the podcast. I would be interested in analysing the audio tracks to extract some features like pitch and intensity. The number of links is about 10,000. Is there any tool I could use to extract such features from the tracks? Thank you very much for your time :)
1
0
1.4k
Feb ’23
Sound output of apple devices
Hi, We are developing a hearing test that runs on apple devices. As part of the process of getting our product certified risk factors are to be assessed. One risk factor can be that the device malfunction and sends a sound (constant high) that ultimately damages the test persons hearing. Is anyone familiar with the hight possible output of sound (in dB) from apple devices?
2
0
990
Oct ’22
Sound decibel recognition
Hi Community Members, We tried to find the particular sound through the microphone. We used PKCCheck to detect the sound decibel. we detect the sound based on the number of dB values per second we receive and add some logic over it to get the result, but when we have continuous sound like an alarm we can't detect it as the gap between the sound is very less. Any suggestion on libraries to achieve this. Also whether we can achieve this thru Frequency & Amplitude method. Please advise.
0
0
1.1k
Oct ’22
iOS app crashes when running this code
This code crashed when running startApplianceListener() when using onAppear() on a swiftui view import AVFAudio import CoreML import SoundAnalysis /// An observer that receives results from a classify sound request. class ResultsObserver: NSObject, SNResultsObserving {     /// Notifies the observer when a request generates a prediction.     func request(_ request: SNRequest, didProduce result: SNResult) {         // Downcast the result to a classification result.         guard let result = result as? SNClassificationResult else  { return }         // Get the prediction with the highest confidence.         guard let classification = result.classifications.first else { return }         // Get the starting time.         let timeInSeconds = result.timeRange.start.seconds         // Convert the time to a human-readable string.         let formattedTime = String(format: "%.2f", timeInSeconds)         print("Analysis result for audio at time: \(formattedTime)")         // Convert the confidence to a percentage string.         let percent = classification.confidence * 100.0         let percentString = String(format: "%.2f%%", percent)         // Print the classification's name (label) with its confidence.         print("\(classification.identifier): \(percentString) confidence.\n")     }     /// Notifies the observer when a request generates an error.     func request(_ request: SNRequest, didFailWithError error: Error) {         print("The the analysis failed: \(error.localizedDescription)")     }     /// Notifies the observer when a request is complete.     func requestDidComplete(_ request: SNRequest) {         print("The request completed successfully!")     } } func startApplianceListener() {     do {         var audioEngine: AVAudioEngine?         var inputBus: Int?         var inputFormat: AVAudioFormat?         var streamAnalyzer: SNAudioStreamAnalyzer         func startAudioEngine() {             audioEngine = AVAudioEngine()                          inputBus = AVAudioNodeBus(0)             inputFormat = audioEngine!.inputNode.inputFormat(forBus: inputBus!)             do {                 try audioEngine!.start()             } catch {                 print("Unable to start AVAudioEngine \(error.localizedDescription)")                 exit(1)             }         }         startAudioEngine()         streamAnalyzer = SNAudioStreamAnalyzer(format: inputFormat!)         let version1 = SNClassifierIdentifier.version1         let request = try SNClassifySoundRequest(classifierIdentifier: version1)         let resultsObserver = ResultsObserver()         try streamAnalyzer.add(request,                                withObserver: resultsObserver)         func installAudioTap() {             audioEngine!.inputNode.installTap(onBus: inputBus!,                                               bufferSize: 8192,                                               format: inputFormat,                                               block: analyzeAudio(buffer:at:))         }         let analysisQueue = DispatchQueue(label: "dev.paulwalker.AnalysisQueue")         func analyzeAudio(buffer: AVAudioBuffer, at time: AVAudioTime) {             analysisQueue.async {                 streamAnalyzer.analyze(buffer,                                        atAudioFramePosition: time.sampleTime)             }         }         installAudioTap()     } catch {} }
1
0
999
Mar ’22
How to convert audio-files from smrc-format to playable format?
I have to process interviews, recorded on iphone and sent to me in smrc-format. I have been unable to find a file-converter able to read smrc and convert to mp3 or comparable. Is there a way to make these files audible? The header of one of these files starts like this: bplist00‘ ûüX$versionX$objectsY$archiverT$top � Ü†Ø ( $%&-89:;<=>IMPSVY_bepsvy| äçêìñóòôùU$null“ V$classZNS.objectsÄ ´ Help would be greatly appreciated, the interviews cannot be done again.
0
0
898
Mar ’22
Can you perform two or more OFFLINE speech recognition tasks simultaneously?
Can you perform two or more OFFLINE speech recognition tasks simultaneously? SFSpeechRecognizer, SFSpeechURLRecognitionRequest offline limitation? Running on macOS Big Sur 11.5.2 I would like to be perform two or more offline speech recognition tasks simultaneously. I've executed two tasks in the same application AND executed two different applications, both using offline recognition. Once I initiate the other thread or other application, the first recognition stops. Since the computer supports multiple threads, I planned to take make use of the concurrency. Use cases #1 multiple Audio or video files that I wish to transcribe -- cuts down on the wait time. #2 split a single large file up into multiple sections and stitch the results together -- again cuts down on the wait time. I set on device recognition to TRUE because my target files can be up to two hours in length. My test files are 15-30 minutes in length and I have a number of them, so recognition must be done on the device. func recognizeFile_Compact(url:NSURL) { let language = "en-US" //"en-GB" let recognizer = SFSpeechRecognizer(locale: Locale.init(identifier: language))! let recogRequest = SFSpeechURLRecognitionRequest(url: url as URL) recognizer.supportsOnDeviceRecognition = true // ensure the DEVICE does the work -- don't send to cloud recognizer.defaultTaskHint = .dictation // give a hint as dictation recogRequest.requiresOnDeviceRecognition = true // don recogRequest.shouldReportPartialResults = false // we dont want partial results var strCount = 0 let recogTask = recognizer.recognitionTask(with: recogRequest, resultHandler: { (result, error) in guard let result = result else { print("Recognition failed, \(error!)") return } let text = result.bestTranscription.formattedString strCount += 1 print(" #\(strCount), "Best: \(text) \n" ) if (result.isFinal) { print("WE ARE FINALIZED") } }) }
1
0
1.9k
Nov ’21
🔇Unable to run audio libraries in tensorflow-metal virtual environment
Hello, I made a post earlier comparing the performance between the latest release of tensorflow with apple silicon support: https://developer.apple.com/forums/thread/687654. In my testing the GitHub alpha greatly outperforms the current release. I provided an installation guide for the GitHub alpha in that post. sounddevice: https://pypi.org/project/sounddevice/ My goal is to get the python library sounddevice working in either of the virtual environments created by the two different tensorflow releases for apple silicon. Preferably the GitHub alpha, since its much faster. The two releases being the current release https://developer.apple.com/metal/tensorflow-plugin/ using a conda virtual environment, or the GitHub alpha release which can be setup using the installer script. GitHub alpha venv errors Installation: First I make an environment following the installation guide I provided in my first post (linked above). I activate the virtual environment I install sounddevice using the following command: $ python3 -m pip install sounddevice When I try to import sounddevice I get the following errors: Traceback (most recent call last): File "/Users/sadedwar/code/fun/ga-synth/venv/lib/python3.8/site-packages/sounddevice.py", line 72, in <module> _lib = _ffi.dlopen(_libname) OSError: cannot load library '/usr/local/lib/libportaudio.dylib': dlopen(/usr/local/lib/libportaudio.dylib, 2): no suitable image found. Did find: /usr/local/lib/libportaudio.dylib: mach-o, but wrong architecture /usr/local/Cellar/portaudio/19.7.0/lib/libportaudio.2.dylib: mach-o, but wrong architecture tensorflow-metal PluggableDevice errors Installation: exactly as described in: https://developer.apple.com/metal/tensorflow-plugin/ I install python-sounddevice from: https://anaconda.org/conda-forge/python-sounddevice importing works fine When I try to run the following code: myrecording = sd.rec(int(duration * samplerate), samplerate=samplerate, channels=channels) it yields this error: Traceback (most recent call last): File "/Users/sadedwar/code/fun/ga-synth/makeDatasets.py", line 41, in <module> render_dataset(make_simple_dataset(100)) File "/Users/sadedwar/code/fun/ga-synth/makeDatasets.py", line 37, in render_dataset data, samplerate = audioRecorder.play_and_rec() File "/Users/sadedwar/code/fun/ga-synth/audioRecorder.py", line 29, in play_and_rec recording, samplerate = rec_mono_16bit_8kHz(duration=0.1) File "/Users/sadedwar/code/fun/ga-synth/audioRecorder.py", line 17, in rec_mono_16bit_8kHz myrecording = sd.rec(int(duration * samplerate), samplerate=samplerate, channels=channels) File "/Users/sadedwar/miniforge3/envs/machinelearning/lib/python3.9/site-packages/sounddevice.py", line 274, in rec ctx.start_stream(InputStream, samplerate, ctx.input_channels, File "/Users/sadedwar/miniforge3/envs/machinelearning/lib/python3.9/site-packages/sounddevice.py", line 2573, in start_stream self.stream = StreamClass(samplerate=samplerate, File "/Users/sadedwar/miniforge3/envs/machinelearning/lib/python3.9/site-packages/sounddevice.py", line 1415, in __init__ _StreamBase.__init__(self, kind='input', wrap_callback='array', File "/Users/sadedwar/miniforge3/envs/machinelearning/lib/python3.9/site-packages/sounddevice.py", line 836, in __init__ def callback_ptr(iptr, optr, frames, time, status, _): MemoryError: Cannot allocate write+execute memory for ffi.callback(). You might be running on a system that prevents this. For more information, see https://cffi.readthedocs.io/en/latest/using.html#callbacks Any help is appreciated, thank you.
0
0
1.6k
Aug ’21
Using SNAudioStreamAnalyzer with AVCaptureVideoDataOutputSampleBufferDelegate
I would like to use both an Image Classifier and a Sound Classifier in my application. Since I have a video stream in use for both image analysis and speech recognition, I'd like to use the same AVCapture related APIs to analyze sound. I don't seem able to do that since the analyze function of the stream analyzer requires the audio format and frame position. I've only seen SNAudioStreamAnalyzer examples with the AVAudioEngine and node.installTap APIs. Is it possible to use AVCaptureSession and public func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) to trigger SNAudioStreamAnalyzer.analyze?
0
1
595
Jul ’21
Cracking Popping Sound When Playing a Video on Montery 12.6.7
It is so frustrating and the second time this has happened to me. I found a fix for the first time, but can't seem to find one now. Help! Anyone know what to do to stop the noise? Lisa
Replies
1
Boosts
1
Views
1.1k
Activity
Jul ’23
Unexpected results from SNClassifySoundRequest
I'm seeing unexpected results when examining the results from a sound classification test. Whilst I appear to get accurate startTime for observations, the duration is always the same as the value put into the windowDuration. I'm guessing I'm misunderstanding the purpose of duration in the classification results. The link here says: The time range’s CMTime values are the number of audio frames at the analyzer’s sample rate. Use these time indices to determine where, in time, the result corresponds to the original audio. My understanding of this statement is it should give me the startTime AND the duration of that detection event. For example, if I attempt to detect a crowd sound and that sound lasts for 1.8 seconds, then I should see 1.8 seconds in the duration. Below is some code showing what I'm seeing. Initialisation of request.windDuration of 1 second. If I change this to any other value, that value is reported back as the duration of the event. Even if the event is half a second in duration. Any help in either a code issue or understanding the results better would be appreciated. Thanks let request = try SNClassifySoundRequest(classifierIdentifier: .version1) request.overlapFactor = 0.8 request.windowDuration = CMTimeMakeWithSeconds(600, preferredTimescale: 600) My code to get the values out of the SNResult func request(_ request: SNRequest, didProduce result: SNResult) { guard let analysisResult = result as? SNClassificationResult, let predominantSound = analysisResult.classifications.first?.identifier, soundsToDetect.contains(predominantSound) else { return } let startTime = analysisResult.timeRange.start.seconds let duration = analysisResult.timeRange.duration.seconds let confidence = analysisResult.classifications.first?.confidence ?? 0.0 let detectedSound = ClassificationObject(id: UUID(), name: predominantSound, startTime: startTime, duration: duration, confidence: confidence) self.detectedSounds.append(detectedSound) }
Replies
0
Boosts
0
Views
1.2k
Activity
Apr ’23
Analysis of podcast audio features
Hello! I am working on the final thesis of my Bachelor Degree, and I would like to focus on podcasts. I found an interesting dataset on Kaggle which includes reviews of iTunes podcasts and the link to the podcast. I would be interested in analysing the audio tracks to extract some features like pitch and intensity. The number of links is about 10,000. Is there any tool I could use to extract such features from the tracks? Thank you very much for your time :)
Replies
1
Boosts
0
Views
1.4k
Activity
Feb ’23
Safari sound problem, it became mono.
i have a MacBook Pro 15' 2015mid. I use with an audio interface (soundcraft ui 24r). it has 32 Chanels. 10-out 22in puts. when I want play something audio in safari, it is mono. But when I play example spotfy, iTunes, are stereo. what could be the problem? how could I change safari audio to stereo?
Replies
0
Boosts
0
Views
1.4k
Activity
Dec ’22
Sound output of apple devices
Hi, We are developing a hearing test that runs on apple devices. As part of the process of getting our product certified risk factors are to be assessed. One risk factor can be that the device malfunction and sends a sound (constant high) that ultimately damages the test persons hearing. Is anyone familiar with the hight possible output of sound (in dB) from apple devices?
Replies
2
Boosts
0
Views
990
Activity
Oct ’22
Sound decibel recognition
Hi Community Members, We tried to find the particular sound through the microphone. We used PKCCheck to detect the sound decibel. we detect the sound based on the number of dB values per second we receive and add some logic over it to get the result, but when we have continuous sound like an alarm we can't detect it as the gap between the sound is very less. Any suggestion on libraries to achieve this. Also whether we can achieve this thru Frequency & Amplitude method. Please advise.
Replies
0
Boosts
0
Views
1.1k
Activity
Oct ’22
Issue with the right speaker crackling of MacBook Pro 2020.
I have issue of crackling sound from the right speaker of MacBook Pro 13 inches 2020. I started getting this problem after downloading macOS Big Sur 11.4. I am considering this is an issue. Any suggestions or solution for it?
Replies
1
Boosts
0
Views
4.2k
Activity
Apr ’22
Save selected sounds of the list
Hi, Is it possible to save the selected sounds in the app? so you don't have to choose again when you close the app.
Replies
0
Boosts
0
Views
786
Activity
Mar ’22
list of sound classes in Sound Analysis announced in WWDC 2021
Dear all, I found the announced built-in sound classifier pretty amazing. I would appreciate it if you could point me to a link or a document that is listed all 300 sound classes mentioned in https://developer.apple.com/videos/play/wwdc2021/10036/. Thank you
Replies
2
Boosts
0
Views
2.9k
Activity
Mar ’22
iOS app crashes when running this code
This code crashed when running startApplianceListener() when using onAppear() on a swiftui view import AVFAudio import CoreML import SoundAnalysis /// An observer that receives results from a classify sound request. class ResultsObserver: NSObject, SNResultsObserving {     /// Notifies the observer when a request generates a prediction.     func request(_ request: SNRequest, didProduce result: SNResult) {         // Downcast the result to a classification result.         guard let result = result as? SNClassificationResult else  { return }         // Get the prediction with the highest confidence.         guard let classification = result.classifications.first else { return }         // Get the starting time.         let timeInSeconds = result.timeRange.start.seconds         // Convert the time to a human-readable string.         let formattedTime = String(format: "%.2f", timeInSeconds)         print("Analysis result for audio at time: \(formattedTime)")         // Convert the confidence to a percentage string.         let percent = classification.confidence * 100.0         let percentString = String(format: "%.2f%%", percent)         // Print the classification's name (label) with its confidence.         print("\(classification.identifier): \(percentString) confidence.\n")     }     /// Notifies the observer when a request generates an error.     func request(_ request: SNRequest, didFailWithError error: Error) {         print("The the analysis failed: \(error.localizedDescription)")     }     /// Notifies the observer when a request is complete.     func requestDidComplete(_ request: SNRequest) {         print("The request completed successfully!")     } } func startApplianceListener() {     do {         var audioEngine: AVAudioEngine?         var inputBus: Int?         var inputFormat: AVAudioFormat?         var streamAnalyzer: SNAudioStreamAnalyzer         func startAudioEngine() {             audioEngine = AVAudioEngine()                          inputBus = AVAudioNodeBus(0)             inputFormat = audioEngine!.inputNode.inputFormat(forBus: inputBus!)             do {                 try audioEngine!.start()             } catch {                 print("Unable to start AVAudioEngine \(error.localizedDescription)")                 exit(1)             }         }         startAudioEngine()         streamAnalyzer = SNAudioStreamAnalyzer(format: inputFormat!)         let version1 = SNClassifierIdentifier.version1         let request = try SNClassifySoundRequest(classifierIdentifier: version1)         let resultsObserver = ResultsObserver()         try streamAnalyzer.add(request,                                withObserver: resultsObserver)         func installAudioTap() {             audioEngine!.inputNode.installTap(onBus: inputBus!,                                               bufferSize: 8192,                                               format: inputFormat,                                               block: analyzeAudio(buffer:at:))         }         let analysisQueue = DispatchQueue(label: "dev.paulwalker.AnalysisQueue")         func analyzeAudio(buffer: AVAudioBuffer, at time: AVAudioTime) {             analysisQueue.async {                 streamAnalyzer.analyze(buffer,                                        atAudioFramePosition: time.sampleTime)             }         }         installAudioTap()     } catch {} }
Replies
1
Boosts
0
Views
999
Activity
Mar ’22
How to convert audio-files from smrc-format to playable format?
I have to process interviews, recorded on iphone and sent to me in smrc-format. I have been unable to find a file-converter able to read smrc and convert to mp3 or comparable. Is there a way to make these files audible? The header of one of these files starts like this: bplist00‘ ûüX$versionX$objectsY$archiverT$top � Ü†Ø ( $%&-89:;<=>IMPSVY_bepsvy| äçêìñóòôùU$null“ V$classZNS.objectsÄ ´ Help would be greatly appreciated, the interviews cannot be done again.
Replies
0
Boosts
0
Views
898
Activity
Mar ’22
Can you perform two or more OFFLINE speech recognition tasks simultaneously?
Can you perform two or more OFFLINE speech recognition tasks simultaneously? SFSpeechRecognizer, SFSpeechURLRecognitionRequest offline limitation? Running on macOS Big Sur 11.5.2 I would like to be perform two or more offline speech recognition tasks simultaneously. I've executed two tasks in the same application AND executed two different applications, both using offline recognition. Once I initiate the other thread or other application, the first recognition stops. Since the computer supports multiple threads, I planned to take make use of the concurrency. Use cases #1 multiple Audio or video files that I wish to transcribe -- cuts down on the wait time. #2 split a single large file up into multiple sections and stitch the results together -- again cuts down on the wait time. I set on device recognition to TRUE because my target files can be up to two hours in length. My test files are 15-30 minutes in length and I have a number of them, so recognition must be done on the device. func recognizeFile_Compact(url:NSURL) { let language = "en-US" //"en-GB" let recognizer = SFSpeechRecognizer(locale: Locale.init(identifier: language))! let recogRequest = SFSpeechURLRecognitionRequest(url: url as URL) recognizer.supportsOnDeviceRecognition = true // ensure the DEVICE does the work -- don't send to cloud recognizer.defaultTaskHint = .dictation // give a hint as dictation recogRequest.requiresOnDeviceRecognition = true // don recogRequest.shouldReportPartialResults = false // we dont want partial results var strCount = 0 let recogTask = recognizer.recognitionTask(with: recogRequest, resultHandler: { (result, error) in guard let result = result else { print("Recognition failed, \(error!)") return } let text = result.bestTranscription.formattedString strCount += 1 print(" #\(strCount), "Best: \(text) \n" ) if (result.isFinal) { print("WE ARE FINALIZED") } }) }
Replies
1
Boosts
0
Views
1.9k
Activity
Nov ’21
MLSoundClassifier.FeatureExtractionParameters with shorter featureExtractionTimeWindowSize
Hi there, I'm trying to train an mlmodel using shorter file lengths. I'd like to not have a lower limit on the length of the audio. Is there any way to do this?
Replies
0
Boosts
0
Views
692
Activity
Oct ’21
🔇Unable to run audio libraries in tensorflow-metal virtual environment
Hello, I made a post earlier comparing the performance between the latest release of tensorflow with apple silicon support: https://developer.apple.com/forums/thread/687654. In my testing the GitHub alpha greatly outperforms the current release. I provided an installation guide for the GitHub alpha in that post. sounddevice: https://pypi.org/project/sounddevice/ My goal is to get the python library sounddevice working in either of the virtual environments created by the two different tensorflow releases for apple silicon. Preferably the GitHub alpha, since its much faster. The two releases being the current release https://developer.apple.com/metal/tensorflow-plugin/ using a conda virtual environment, or the GitHub alpha release which can be setup using the installer script. GitHub alpha venv errors Installation: First I make an environment following the installation guide I provided in my first post (linked above). I activate the virtual environment I install sounddevice using the following command: $ python3 -m pip install sounddevice When I try to import sounddevice I get the following errors: Traceback (most recent call last): File "/Users/sadedwar/code/fun/ga-synth/venv/lib/python3.8/site-packages/sounddevice.py", line 72, in <module> _lib = _ffi.dlopen(_libname) OSError: cannot load library '/usr/local/lib/libportaudio.dylib': dlopen(/usr/local/lib/libportaudio.dylib, 2): no suitable image found. Did find: /usr/local/lib/libportaudio.dylib: mach-o, but wrong architecture /usr/local/Cellar/portaudio/19.7.0/lib/libportaudio.2.dylib: mach-o, but wrong architecture tensorflow-metal PluggableDevice errors Installation: exactly as described in: https://developer.apple.com/metal/tensorflow-plugin/ I install python-sounddevice from: https://anaconda.org/conda-forge/python-sounddevice importing works fine When I try to run the following code: myrecording = sd.rec(int(duration * samplerate), samplerate=samplerate, channels=channels) it yields this error: Traceback (most recent call last): File "/Users/sadedwar/code/fun/ga-synth/makeDatasets.py", line 41, in <module> render_dataset(make_simple_dataset(100)) File "/Users/sadedwar/code/fun/ga-synth/makeDatasets.py", line 37, in render_dataset data, samplerate = audioRecorder.play_and_rec() File "/Users/sadedwar/code/fun/ga-synth/audioRecorder.py", line 29, in play_and_rec recording, samplerate = rec_mono_16bit_8kHz(duration=0.1) File "/Users/sadedwar/code/fun/ga-synth/audioRecorder.py", line 17, in rec_mono_16bit_8kHz myrecording = sd.rec(int(duration * samplerate), samplerate=samplerate, channels=channels) File "/Users/sadedwar/miniforge3/envs/machinelearning/lib/python3.9/site-packages/sounddevice.py", line 274, in rec ctx.start_stream(InputStream, samplerate, ctx.input_channels, File "/Users/sadedwar/miniforge3/envs/machinelearning/lib/python3.9/site-packages/sounddevice.py", line 2573, in start_stream self.stream = StreamClass(samplerate=samplerate, File "/Users/sadedwar/miniforge3/envs/machinelearning/lib/python3.9/site-packages/sounddevice.py", line 1415, in __init__ _StreamBase.__init__(self, kind='input', wrap_callback='array', File "/Users/sadedwar/miniforge3/envs/machinelearning/lib/python3.9/site-packages/sounddevice.py", line 836, in __init__ def callback_ptr(iptr, optr, frames, time, status, _): MemoryError: Cannot allocate write+execute memory for ffi.callback(). You might be running on a system that prevents this. For more information, see https://cffi.readthedocs.io/en/latest/using.html#callbacks Any help is appreciated, thank you.
Replies
0
Boosts
0
Views
1.6k
Activity
Aug ’21
Using SNAudioStreamAnalyzer with AVCaptureVideoDataOutputSampleBufferDelegate
I would like to use both an Image Classifier and a Sound Classifier in my application. Since I have a video stream in use for both image analysis and speech recognition, I'd like to use the same AVCapture related APIs to analyze sound. I don't seem able to do that since the analyze function of the stream analyzer requires the audio format and frame position. I've only seen SNAudioStreamAnalyzer examples with the AVAudioEngine and node.installTap APIs. Is it possible to use AVCaptureSession and public func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) to trigger SNAudioStreamAnalyzer.analyze?
Replies
0
Boosts
1
Views
595
Activity
Jul ’21