normalize

AVAudioRecorder normalize volume

你离开我真会死。 提交于 2019-12-04 10:06:46
I've got an app that records audio. I'm wondering how I can increase the gain. is there a way to normalize the audio or amplify it somehow? thanks, howie Looks like I found a solution. According to the documentation the AVAudioPlayer volume can be between 0.0 and 1.0. Apparently it can be set to a value greater than 1.0. By increasing the volume I was able to achieve the same desired result. While it's not normalized, the gain is increased. #import <AudioToolbox/AudioServices.h> UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker; AudioSessionSetProperty (kAudioSessionProperty

Normalizing histogram bins in gnuplot

戏子无情 提交于 2019-12-04 09:38:28
问题 I'm trying to plot a histogram whose bins are normalized by the number of elements in the bin. I'm using the following binwidth=5 bin(x,width)=width*floor(x/width) + binwidth/2.0 plot 'file' using (bin($2, binwidth)):($4) smooth freq with boxes to get a basic histogram, but I want the value of each bin to be divided by the size of the bin. How can I go about this in gnuplot, or using external tools if necessary? 回答1: In gnuplot 4.4, functions take on a different property, in that they can

how can I revert webkit-appearance for input[type=“search”] of normalize.css

我们两清 提交于 2019-12-04 07:45:43
I'm using normalize.css and it does remove the icon for search inputs input[type="search"]::-webkit-search-cancel-button, input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; } I want to revert some selectors (not all!) in my css file, but I cannot find the default user agent styles for it. for the search cancel button the solution is: input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: searchfield-cancel-button; } But the webkit-search-decoration property isn't reverted and I don't know what was also be normalized. And I cannot inspect the styles

Normalizing from [0.5 - 1] to [0 - 1]

情到浓时终转凉″ 提交于 2019-12-04 07:32:00
问题 I'm kind of stuck here, I guess it's a bit of a brain teaser. If I have numbers in the range between 0.5 to 1 how can I normalize it to be between 0 to 1? Thanks for any help, maybe I'm just a bit slow since I've been working for the past 24 hours straight O_O 回答1: Others have provided you the formula, but not the work. Here's how you approach a problem like this. You might find this far more valuable than just knowning the answer. To map [0.5, 1] to [0, 1] we will seek a linear map of the

How to normalize a list of positive and negative decimal number to a specific range

谁说我不能喝 提交于 2019-12-04 05:39:53
I have a list of decimal numbers as follows: [-23.5, -12.7, -20.6, -11.3, -9.2, -4.5, 2, 8, 11, 15, 17, 21] I need to normalize this list to fit into the range [-5,5] . How can I do it in python? To get the range of input is very easy: old_min = min(input) old_range = max(input) - old_min Here's the tricky part. You can multiply by the new range and divide by the old range, but that almost guarantees that the top bucket will only get one value in it. You need to expand your output range so that the top bucket is the same size as all the other buckets. new_min = -5 new_range = 5 + 0.9999999999

Denormalizing for sanity or performance?

我们两清 提交于 2019-12-04 03:37:25
I've started a new project and they have a very normalized database. everything that can be a lookup is stored as the foreign key to the lookup table. this is normalized and fine, but I end up doing 5 table joins for the simplest queries. from va in VehicleActions join vat in VehicleActionTypes on va.VehicleActionTypeId equals vat.VehicleActionTypeId join ai in ActivityInvolvements on va.VehicleActionId equals ai.VehicleActionId join a in Agencies on va.AgencyId equals a.AgencyId join vd in VehicleDescriptions on ai.VehicleDescriptionId equals vd.VehicleDescriptionId join s in States on vd

Replace Multiple Spaces and Newlines with only one space in PHP

余生长醉 提交于 2019-12-04 01:27:47
I have a string with multiple newlines. The String: This is a dummy text. I need to format this. Desired Output: This is a dummy text. I need to format this. I'm using this: $replacer = array("\r\n", "\n", "\r", "\t", " "); $string = str_replace($replacer, "", $string); But it is not working as desired/required. Some of the words don't have spaces between them. Actually I need to convert the string with all the words separated by single spaces. I would encourage you to use preg_replace : # string(45) "This is a dummy text . I need to format this." $str = preg_replace( "/\s+/", " ", $str );

Normalize/Standardize a numpy recarray

…衆ロ難τιáo~ 提交于 2019-12-03 07:29:47
I wonder what the best way of normalizing/standardizing a numpy recarray is. To make it clear, I'm not talking about a mathematical matrix, but a record array that also has e.g. textual columns (such as labels). a = np.genfromtxt("iris.csv", delimiter=",", dtype=None) print a.shape > (150,) As you can see, I cannot e.g. process a[:,:-1] as the shape is one-dimensional. The best I found is to iterate over all columns: for nam in a.dtype.names[:-1]: col = a[nam] a[nam] = (col - col.min()) / (col.max() - col.min()) Any more elegant way of doing this? Is there some method such as "normalize" or

Normalizing histogram bins in gnuplot

做~自己de王妃 提交于 2019-12-03 03:28:59
I'm trying to plot a histogram whose bins are normalized by the number of elements in the bin. I'm using the following binwidth=5 bin(x,width)=width*floor(x/width) + binwidth/2.0 plot 'file' using (bin($2, binwidth)):($4) smooth freq with boxes to get a basic histogram, but I want the value of each bin to be divided by the size of the bin. How can I go about this in gnuplot, or using external tools if necessary? In gnuplot 4.4, functions take on a different property, in that they can execute multiple successive commands, and then return a value (see gnuplot tricks ) This means that you can

How can I draw a log-normalized imshow plot with a colorbar representing the raw data in matplotlib

坚强是说给别人听的谎言 提交于 2019-12-03 01:24:06
I'm using matplotlib to plot log-normalized images but I would like the original raw image data to be represented in the colorbar rather than the [0-1] interval. I get the feeling there's a more matplotlib'y way of doing this by using some sort of normalization object and not transforming the data beforehand... in any case, there could be negative values in the raw image. import matplotlib.pyplot as plt import numpy as np def log_transform(im): '''returns log(image) scaled to the interval [0,1]''' try: (min, max) = (im[im > 0].min(), im.max()) if (max > min) and (max > 0): return (np.log(im