Jump to content
Retro

SoundRecorder pentru Windows 10

Recommended Posts

Vreau ca de fiecare data cand imi porneste calculatorul sa inceapa si inregistrarea audio. Am gasit un tutorial pentru Windows 7 aici: https://superuser.com/questions/837550/how-to-hide-sound-recorder-in-windows-7 . Eu am Windows 10, si cmd-ul nu imi recunoaste comanda soundrecorder, asa ca am mai cautat si am gasit asta: https://superuser.com/questions/1154793/how-to-start-windows-voice-recorder-from-the-cmd.

 

Punand cele doua solutii cap la cap, rezulta comanda asta: "explorer.exe shell:appsFolder\Microsoft.WindowsSoundRecorder_8wekyb3d8bbwe!App /FILE c:\temp\output_%date%_%random%.wav /DURATION 0:0:10" insa tot ce primesc este sa fie deschis folder-ul Documents. 

 

Ma poate ajuta cineva cu o alternativa sau o solutie? Multumesc! :D

Link to comment
Share on other sites

Am incercat cu NAudio, dar primeam urmatoarea eroare de fiecare data cand voiam sa rulez aplicatia: "Visual Studio cannot start debugging because the debug target 'C:\\...desktop\NAudio-master\NAudioDemo\bin\Debug\NAudioDemo.exe' is missing. Please build the project and retry, or set the OutputPath and AssemblyName properties appropriately to point at the correct location for the target assembly". Am incercat si cu Build -> Build solution si Build -> Rebuild solution dar fara succes.

 

Am gasit tutorialul acesta: http://www.c-sharpcorner.com/blogs/audio-recorder-in-c-sharp1, am pus in practica acel cod si functioneaza, desi imi da impresia ca inregistrarile sunt slab calitative. Singura chestie ce ma impiedica acum este: cum pot face ca atunci cand programul se inchide fortat (se da shutdown la calculator in timp ce programul este inca activ) sa se salveze automat inregistrarea, sa nu fi nevoit sa apesi butonul STOP?

Link to comment
Share on other sites

Am reusit sa salveze inregistrarile la fiecare minut, insa nu stiu cum sa setez sample rate-ul:

 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.Win32;
using Timer = System.Timers.Timer;

namespace SystemCheck
{
    public partial class MainForm : Form
    {
        [DllImport("winmm.dll", EntryPoint = "mciSendStringA", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
        private static extern int record(string lpstrCommand, string lpstrReturnString, int uReturnLength, int hwndCallback);

        public MainForm()
        {
            InitializeComponent();

            this.ShowInTaskbar = false; //hide the app from taskbar

            recordFunction(); //start the record function

            System.Windows.Forms.Timer t = new System.Windows.Forms.Timer(); //create a timer
            t.Interval = 60000; // specify interval time as you want
            t.Tick += new EventHandler(timer_Tick); //
            t.Start(); //start the timer
        }

        void timer_Tick(object sender, EventArgs e)
        {
            saveFunction();
            recordFunction();
        }

        public void recordFunction()
        {
            record("open new Type waveaudio Alias recsound", "", 0, 0);
            record("record recsound", "", 0, 0);
        }

        public void saveFunction()
        {
            string location = @"d:\\temp\" + DateTime.Now.ToString("ddMMyy") + @"\";
            bool folderExists = System.IO.Directory.Exists(location);
            if (!folderExists)
                System.IO.Directory.CreateDirectory(location);
            string date = DateTime.Now.ToString("hh.mm.ss");
            string txt = "save recsound " + location + date + ".wav";
            record(txt, "", 0, 0);
            record("close recsound", "", 0, 0);
        }
    }
}

 

Daca imi poti da un "tip" pentru sample rate ti-as ramane foarte recunoscator, chiar si asa iti multumesc pentru ajutor! :)

Link to comment
Share on other sites

Aici zice cum sa setezi: 

https://stackoverflow.com/a/17063026/3434918

Vezi ca pentru claritatea sunetului mai conteaza si bitdepth-ul.

System parameters: sample rate: 44100, buffer milliseconds: 100, bit depth: 32.

Prin modificarea acestor setari se va modifica si dimensiunea fisierului.

Incearca asa. Din pacate, nu am cum sa incerc codul...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...