Retro Posted December 11, 2017 Report Posted December 11, 2017 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! Quote
gigiRoman Posted December 11, 2017 Report Posted December 11, 2017 soundRecorder.exe nu exista in system32? Dc nu e incearca sa il descarci. Cred ca Microsoft.WindowsSoundRecorder_8wekyb3d8bbwe!App /FILE are legatura cu recorderul ala nou a lu Cortana si posibil sa fie prea prost sa fie apelat din linie de comanda. Quote
Retro Posted December 11, 2017 Author Report Posted December 11, 2017 Nu il gasesc in system32, si nu stiu de unde il pot descarca. https://answers.microsoft.com/en-us/windows/forum/windows_7-pictures/the-sound-recorder-progam-of-windows-7-is-missing/83756d6d-1f72-40fa-8de5-12ee4d9c61f8 Am incercat solutia asta insa fara succes: "Windows Resource Protection did not find any integrity violations" Quote
gigiRoman Posted December 11, 2017 Report Posted December 11, 2017 E posibil ca librariile sa nu mai fie compatibile. Am lucrat la o firma care facea un soft de voce si cand a trecut aplicatia pe win10 nu a mai functionat api-ul de la microsoft. Si am mutat pe naudio: https://github.com/naudio/NAudio Poti incerca proiectele demo de la el dc nu iti merge altfel. Da pm dc nu te descurci. Quote
Retro Posted December 13, 2017 Author Report Posted December 13, 2017 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? Quote
gigiRoman Posted December 13, 2017 Report Posted December 13, 2017 Calitatea inregistrarii: ai sample rate-ul setat pe 8000 cred, incearca sa il pui pe 44100. Implementare autostop: faci un timer care face dump in fisier la un interval de timp ales de tine. Quote
Retro Posted December 14, 2017 Author Report Posted December 14, 2017 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! Quote
gigiRoman Posted December 14, 2017 Report Posted December 14, 2017 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... Quote