Home Computer Tutorials Computer Knowledge How to extract speech database using MATLAB

How to extract speech database using MATLAB

Jan 17, 2024 pm 02:48 PM

How to extract speech database using MATLAB

How to extract speech database using matlab

1. Use the audioread(''); function to read the audio file in the computer. The parameter is the path of the audio file:

[sampledata,FS] = audioread('F:1.mp3');

sampledata saves audio signal data, FS is the audio sampling rate, and the sampling rate of MP3 format is generally 44100;

Determine whether the audio data is binaural. If it is binaural, retain the data of one channel. You can use the function of the calsample.m file to achieve this. The content of the file is as follows:

function sample = calsample(sampledata,FS)

temp_sample = resample(sampledata,1,FS/11025);

[m,n] = size(temp_sample);

if (n == 2)

sample = temp_sample(:,1);

else

sample = temp_sample;

end

end

Matlab database programming

A. Use a simple UPDATE

The following example shows how all rows will be affected if the WHERE clause is removed from the UPDATE statement.

The following example illustrates how the publishers table is updated if all publishers in the publishers table move their headquarters to Atlanta, Georgia.

UPDATE publishers

SET city = 'Atlanta', state = 'GA'

This example changes all publisher names to NULL.

UPDATE publishers

SET pub_name = NULL

Calculated values ​​can also be used in updates. This example doubles all prices in the titles table.

UPDATE titles

SET price = price * 2

B. Use the WHERE clause with the UPDATE statement

The WHERE clause specifies the rows to be updated. For example, in the following fictional event, Northern California was renamed Pacifica (abbreviated as PC), and the citizens of Oakland voted to change the name of their city to Bay City. This example shows how to update the authors table for all previous residents of Oakland City whose addresses are out of date.

UPDATE authors

SET state = 'PC', city = 'Bay City'

WHERE state = 'CA' AND city = 'Oakland'

Another statement must be written to change the state name for residents of other Northern California cities.

C. Use information from another table through the UPDATE statement

This example modifies the ytd_sales column in the titles table to reflect the latest sales records in the sales table.

UPDATE titles

SET ytd_sales = titles.ytd_sales sales.qty

FROM titles, sales

WHERE titles.title_id = sales.title_id

AND sales.ord_date = (SELECT MAX(sales.ord_date) FROM sales)

This example assumes that a specific product records only one batch of sales on a specific date, and the update is the latest. If this were not the case (i.e. if more than one batch of sales could be recorded for a particular item on the same day), the example shown here would be wrong. The example works correctly, but each item is updated with only one batch of sales, regardless of how many batches were actually sold that day. This is because an UPDATE statement never updates the same row twice.

For situations where more than one batch of a specific item can be sold on the same day, all sales for each item must be totaled together in the UPDATE statement, as shown in the following example:

UPDATE titles

SET ytd_sales =

(SELECT SUM(qty)

FROM sales

WHERE sales.title_id = titles.title_id

AND sales.ord_date IN (SELECT MAX(ord_date) FROM sales))

FROM titles, sales

D. Using the UPDATE statement with the TOP clause in a SELECT statement

This example updates the state column of the first ten authors from the authors table.

UPDATE authors

SET state = 'ZZ'

FROM (SELECT TOP 10 * FROM authors ORDER BY au_lname) AS t1

WHERE authors.au_id = t1.au_id

How to import data sets into the database using matlab

You can use the xlswrite function directly in the m file: (filename/sheet/range must be added in single quotes)

xlswrite(filename, M); Write the data of matrix M into the Excel file named filename.

xlswrite(filename, M, sheet); Write the data of matrix M to the specified sheet in filename.

xlswrite(filename, M, range); Write the data in matrix M to the Excel file named filename, and the storage area is specified by range, such as 'C1:C2'.

xlswrite(filename, M, sheet, range); Specifies the sheet to be stored based on the previous command.

status = xlswrite(filename, ...); Return the completion status value. If the writing is successful, the status is 1; otherwise, the writing fails, the status is 0.

[status, message] = xlswrite(filename, ...);Return any error or warning information generated due to the write operation

Application examples

Example 1: Write data to the default worksheet

Write a seven-element vector into testdata.xls. In the default format, data will be written to cells A1 to G1 of the first worksheet in the file. xlswrite('testdata.xls', [12.7 5.02 -98 63.9 0 -.2 56])

Example 2: Write mixed data into the specified worksheet

d = {'Time', 'Temp'; 12 98; 13 99; 14 97};

s = xlswrite('tempdata.xls', d, 'Temperatures', 'E1')

The above is the detailed content of How to extract speech database using MATLAB. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How do I edit the Registry? (Warning: Use with caution!) How do I edit the Registry? (Warning: Use with caution!) Mar 21, 2025 pm 07:46 PM

Article discusses editing Windows Registry, precautions, backup methods, and potential issues from incorrect edits. Main issue: risks of system instability and data loss from improper changes.

How do I manage services in Windows? How do I manage services in Windows? Mar 21, 2025 pm 07:52 PM

Article discusses managing Windows services for system health, including starting, stopping, restarting services, and best practices for stability.

How to Fix the Steam Cloud Error? Try These Methods How to Fix the Steam Cloud Error? Try These Methods Apr 04, 2025 am 01:51 AM

The Steam Cloud error can be caused by many reasons. To play a game smoothly, you need to take some measures to remove this error before you launch the game. php.cn Software introduces some best ways as well as more useful information in this post.

Windows Metadata and Internet Services Problem: How to Fix It? Windows Metadata and Internet Services Problem: How to Fix It? Apr 02, 2025 pm 03:57 PM

You may see the “A connection to the Windows Metadata and Internet Services (WMIS) could not be established.” error on Event Viewer. This post from php.cn introduces how to remove the Windows Metadata and Internet Services problem.

How do I change the default app for a file type? How do I change the default app for a file type? Mar 21, 2025 pm 07:48 PM

Article discusses changing default apps for file types on Windows, including reverting and bulk changes. Main issue: no built-in bulk change option.

How to Resolve the KB5035942 Update Issues – Crashing System How to Resolve the KB5035942 Update Issues – Crashing System Apr 02, 2025 pm 04:16 PM

KB5035942 update issues - crashing system commonly happens to users. Inflicted people hope to find a way out of the kind of trouble, such as crashing system, installation, or sound issues. Targeting these situations, this post published by php.cn wil

How do I use the Group Policy Editor (gpedit.msc)? How do I use the Group Policy Editor (gpedit.msc)? Mar 21, 2025 pm 07:48 PM

The article explains how to use the Group Policy Editor (gpedit.msc) in Windows for managing system settings, highlighting common configurations and troubleshooting methods. It notes that gpedit.msc is unavailable in Windows Home editions, suggesting

How to Use Chris Titus Tool to Create a Debloated Win11/10 ISO How to Use Chris Titus Tool to Create a Debloated Win11/10 ISO Apr 01, 2025 am 03:15 AM

Chris Titus Tech has a tool called Windows Utility that can help you easily create a debloated Windows 11/10 ISO to install a clean system. php.cn offers a full guide on how to do this thing using the Chris Titus tool.

See all articles