Giter VIP home page Giter VIP logo

Comments (16)

albho avatar albho commented on May 22, 2024 1

Here's how you can run the examples:

  1. clone the miniaudio repo and cd into the examples directory
  2. run the command from their README (either one under Examples. You may have to change some paths based on your file structure.)
  3. run the output file with with the path to an existing audio file on your device. If working, you'll hear the audio being played out of your speakers.

If this doesn't work, it would be helpful if you could try our file demo and see if that works.

from cobra.

albho avatar albho commented on May 22, 2024 1

Can you try the simple capture example to see if you can record audio, since that is how PvRecorder will be used?

As well, please also try our file demo so we can see if Cobra can initialize.

from cobra.

albho avatar albho commented on May 22, 2024 1

Okay, so since it seems like the issue stems from miniaudio, I recommend you check out the miniaudio docs and see if you can get it working on your device.

from cobra.

albho avatar albho commented on May 22, 2024

Which Raspberry Pi model are you using? Are you using Debian directly or via the Rpi OS? Are you using 32-bit or 64-bit for Debian?

from cobra.

y-lobau avatar y-lobau commented on May 22, 2024

64bit raspberry pi OS installed via pi imager.

from cobra.

albho avatar albho commented on May 22, 2024

Thanks, and which model are you using?

from cobra.

y-lobau avatar y-lobau commented on May 22, 2024

Ah, sorry. It's 3 B.

from cobra.

albho avatar albho commented on May 22, 2024

I'm not able to reproduce the error on my device. Could you give our Node.js demo a try and confirm that that works on your device?

from cobra.

y-lobau avatar y-lobau commented on May 22, 2024

Just tested. It is the same error via the demo:

rpi@rpi:~ $ cobra-mic-demo --access_key <...>
/usr/local/lib/node_modules/@picovoice/cobra-node-demo/node_modules/@picovoice/cobra-node/dist/errors.js:76
            throw new CobraIOError(errorMessage, messageStack);
                  ^

CobraIOError: Cobra failed to initialize: 
  [0] Picovoice Error (code `00000136`)
  [1] Picovoice Error (code `00000136`)
    at pvStatusToException (/usr/local/lib/node_modules/@picovoice/cobra-node-demo/node_modules/@picovoice/cobra-node/dist/errors.js:76:19)
    at Cobra.handlePvStatus (/usr/local/lib/node_modules/@picovoice/cobra-node-demo/node_modules/@picovoice/cobra-node/dist/cobra.js:134:46)
    at new Cobra (/usr/local/lib/node_modules/@picovoice/cobra-node-demo/node_modules/@picovoice/cobra-node/dist/cobra.js:59:18)
    at micDemo (/usr/local/lib/node_modules/@picovoice/cobra-node-demo/mic.js:69:24)
    at Object.<anonymous> (/usr/local/lib/node_modules/@picovoice/cobra-node-demo/mic.js:126:1)
    at Module._compile (node:internal/modules/cjs/loader:1356:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
    at Module.load (node:internal/modules/cjs/loader:1197:32)
    at Module._load (node:internal/modules/cjs/loader:1013:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12) {
  _message: 'Cobra failed to initialize',
  _messageStack: [
    'Picovoice Error (code `00000136`)',
    'Picovoice Error (code `00000136`)'
  ]
} 
rpi@rpi:~ $ arecord -l
**** List of CAPTURE Hardware Devices ****
card 2: Microphones [Blue Microphones], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

The following command records the wav with the input from mic:

arecord -D plughw:2,0 -d 5 test.wav

from cobra.

albho avatar albho commented on May 22, 2024

Is your device connected to internet while initializing?

from cobra.

y-lobau avatar y-lobau commented on May 22, 2024

Yes, It does.
image
Just tried on fresh installation by installing just npm and the demo package. Now, the error is different:

rpi@rpi:~ $ cobra-mic-demo --access_key <...>
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM input
ALSA lib pcm_dsnoop.c:566:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dsnoop.c:566:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dsnoop.c:566:(snd_pcm_dsnoop_open) unable to open slave
/usr/local/lib/node_modules/@picovoice/cobra-node-demo/node_modules/@picovoice/pvrecorder-node/dist/errors.js:47
            return new PvRecorderStatusRuntimeError(errorMessage);
                   ^

PvRecorderStatusRuntimeError: PvRecorder failed to initialize.
    at pvRecorderStatusToException (/usr/local/lib/node_modules/@picovoice/cobra-node-demo/node_modules/@picovoice/pvrecorder-node/dist/errors.js:47:20)
    at new PvRecorder (/usr/local/lib/node_modules/@picovoice/cobra-node-demo/node_modules/@picovoice/pvrecorder-node/dist/pv_recorder.js:47:40)
    at micDemo (/usr/local/lib/node_modules/@picovoice/cobra-node-demo/mic.js:73:20)
    at Object.<anonymous> (/usr/local/lib/node_modules/@picovoice/cobra-node-demo/mic.js:126:1)
    at Module._compile (node:internal/modules/cjs/loader:1356:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
    at Module.load (node:internal/modules/cjs/loader:1197:32)
    at Module._load (node:internal/modules/cjs/loader:1013:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)
    at node:internal/main/run_main_module:28:49

The recording still working fine with arecord.
What am i missing?

from cobra.

albho avatar albho commented on May 22, 2024

Ah, I ran the demo using the full RPi OS instead of the Lite - it's possible you're missing a package. We use mini audio to access the recording device. Could you run one of their examples and make sure mini audio is recording properly?

Alternatively, you can also try our file demo instead, which doesn't require any recording device.

from cobra.

y-lobau avatar y-lobau commented on May 22, 2024

I didn't find a quick and easy way to check if it is working in their docs. The example page you referenced doesn't make a lot of sense to me honestly. Maybe you could suggest which steps I should perform to validate mini audio.

from cobra.

y-lobau avatar y-lobau commented on May 22, 2024

I was able to play audio file via compiled miniaudio. How it can help though?

from cobra.

y-lobau avatar y-lobau commented on May 22, 2024

I just checked the simple capture example. Indeed it seems smth is missing:

rpi@rpi:~/miniaudio/examples/bin $ ./simple_capture test.mp3
ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM input
ALSA lib pcm_dsnoop.c:566:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dsnoop.c:566:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dsnoop.c:566:(snd_pcm_dsnoop_open) unable to open slave
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
Press Enter to stop recording...

from cobra.

laves avatar laves commented on May 22, 2024

Closing because this seems like an issue with miniaudio/audio recording and not cobra

from cobra.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.